protected void Page_Load(object sender, System.EventArgs e)
{
// Use first tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell = new FarPoint.Web.Spread.TagCloudCellType();
tagCell.DataSource = GetData();//refer to the data source part.
tagCell.DataTextField = "Name";
tagCell.DataWeightField = "Weight";
tagCell.DataTitleField = "University";
tagCell.DataHrefField = "Favorite site";
tagCell.DataTextFormatString = "UserName:{0}";
tagCell.DataTitleFormatString = "Graduate from:[{0}]";
tagCell.DataHrefFormatString = "http://{0}";
tagCell.DataDisplayTextField = "University";
tagCell.DataItemDataField = "Weight";
FpSpread1.ActiveSheetView.Cells[0, 0].CellType = tagCell;
// Use second tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell1 = new FarPoint.Web.Spread.TagCloudCellType(new string[] { "SEARCH", "ASP.NET", "Windows Forms" }, new string[] { "20", "50", "30" });
FpSpread1.ActiveSheetView.Cells[1, 0].CellType = tagCell1;
// Use third tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell2 = new FarPoint.Web.Spread.TagCloudCellType(new string[] { "SEARCH", "ASP.NET", "Windows Forms" }, new string[] { "20", "50", "30" }, new string[] { "http://www.google.com", "http://www.grapecity.com/tools/products/spreadasp8", "http://www.grapecity.com/tools/products/spreadwin8" });
FpSpread1.ActiveSheetView.Cells[2, 0].CellType = tagCell2;
}
private DataTable GetData()
{
DataTable table = new DataTable("Demo");
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("University", typeof(string));
table.Columns.Add("Favorite site", typeof(string));
table.Columns.Add("Weight", typeof(int));
table.Rows.Add(new object[] { 1, "Spread User", "GrapeCity", "www.grapecity.com", 20 });
table.Rows.Add(new object[] { 2, "Google User", "Google", "www.google.com", 3 });
table.Rows.Add(new object[] { 3, "Microsoft Developer", "Microsoft", "www.microsoft.com", 1 });
table.Rows.Add(new object[] { 4, "Code Project User", "CodeProject", "www.codeproject.com", 10 });
return table;
}
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Use first tag cloud cell type constructor.
Dim tagCell As New FarPoint.Web.Spread.TagCloudCellType()
tagCell.DataSource = GetData() 'refer to the data source part.
tagCell.DataTextField = "Name"
tagCell.DataWeightField = "Weight"
tagCell.DataTitleField = "University"
tagCell.DataHrefField = "Favorite site"
tagCell.DataTextFormatString = "UserName:{0}"
tagCell.DataTitleFormatString = "Graduate from:{0}"
tagCell.DataHrefFormatString = "http://{0}"
tagCell.DataDisplayTextField = "University"
tagCell.DataItemDataField = "Weight"
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = tagCell '
' Use second tag cloud cell type constructor.
Dim tagCell1 As New FarPoint.Web.Spread.TagCloudCellType(New String() {"SEARCH", "ASP.NET", "Windows Forms"}, New String() {"20", "50", "30"})
FpSpread1.ActiveSheetView.Cells(1, 0).CellType = tagCell1 '
' Use third tag cloud cell type constructor.
Dim tagCell2 As New FarPoint.Web.Spread.TagCloudCellType(New String() {"SEARCH", "ASP.NET", "Windows Forms"}, New String() {"20", "50", "30"}, New String() {"http://www.google.com", "http://www.grapecity.com/tools/products/spreadasp8", "http://www.grapecity.com/tools/products/spreadwin8"})
FpSpread1.ActiveSheetView.Cells(2, 0).CellType = tagCell2 '
End Sub
Private Function GetData() As DataTable
Dim table As New DataTable("Demo")
table.Columns.Add("ID", GetType(Integer))
table.Columns.Add("Name", GetType(String))
table.Columns.Add("University", GetType(String))
table.Columns.Add("Favorite site", GetType(String))
table.Columns.Add("Weight", GetType(Integer))
table.Rows.Add(New Object() {1, "Spread User", "GrapeCity", "www.grapecity.com", 20})
table.Rows.Add(New Object() {2, "Google User", "Google", "www.google.com", 3})
table.Rows.Add(New Object() {3, "Microsoft Developer", "Microsoft", "www.microsoft.com", 1})
table.Rows.Add(New Object() {4, "Code Project User", "CodeProject", "www.codeproject.com", 10})
Return table
End Function 'GetData